#include "StdAfx.h"
#include "CPUID.h"


CPUID::CPUID(void)
{
	MMXSupport=false;
	SSESupport=false;
	SSE2Support=false;
	SSE3Support=false;
	SSSE3Support=false;
	SSE41Support=false;
	SSE42Support=false;
	AESSupport=false;
	AVXSupport=false;
}


CPUID::~CPUID(void)
{
}

void CPUID::CheckExtension(void)
{
	int intedx = 0;
	int inteax = 0;
	int intecx = 0;

	__asm
	{
		mov eax, 1H
		cpuid
		mov inteax, eax
		mov intedx, edx
		mov intecx, ecx
	}
	if(intedx&(1 << 23))this->MMXSupport=true;
	if(intedx&(1 << 25))this->SSESupport=true;
	if(intedx&(1 << 26))this->SSE2Support=true;
	if(intecx&(1 << 0)) this->SSE3Support=true;;
	if(intecx&(1 << 9))	this->SSSE3Support=true;
	if(intecx&(1 << 19))this->SSE41Support=true;
	if(intecx&(1 << 20))this->SSE42Support=true;
	if(intecx&(1 << 25))this->AESSupport=true;
	if(intecx&(1 << 28))this->AVXSupport=true;
}

bool CPUID::GetMMXSupport()
{
	return this->MMXSupport;
}

bool CPUID::GetSSESupport()
{
	return this->SSESupport;
}

bool CPUID::GetSSE2Support()
{
	return this->SSE2Support;
}

bool CPUID::GetSSE3Support()
{
	return this->SSE3Support;
}

bool CPUID::GetSSSE3Support()
{
	return this->SSSE3Support;
}

bool CPUID::GetSSE41Support()
{
	return this->SSE41Support;
}

bool CPUID::GetSSE42Support()
{
	return this->SSE42Support;
}

bool CPUID::GetAESSupport()
{
	return this->AESSupport;
}

bool CPUID::GetAVXSupport()
{
	return this->AVXSupport;
}
	